package com.appsys.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Msg { //提示信息集合
    private String code; //状态码 100成功,200失败
    private String msg;  //提示信息
    private Map<String,Object> extend=new HashMap<String,Object>(); //返回保存的数据
    public static Msg success(){
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setMsg("处理成功！");
        return msg;
    }
    public static Msg failure(){
        Msg msg = new Msg();
        msg.setCode("100");
        msg.setMsg("处理失败！");
        return msg;
    }
    public Msg add(String key,Object value){
        this.getExtend().put(key, value);
        return this;
    }
}
